#ifndef CVIPRIMITIVEMEMORYMANAGER_H_INCLUDED
#define CVIPRIMITIVEMEMORYMANAGER_H_INCLUDED

//predecl

//includes
namespace cvRenderInterface
{
	/**
	 *	@class PrimitiveMemoryManager pure interface
	 *	@brief the class manages server datastuctures on
	 *	where the client nodes refer.
	 */
	class PrimitiveMemoryManager
	{
		public:
			/// Reserves read-write storgate memory for the primitive
			virtual void * accuirePrimitive() =0;
			/// Releases the read-write primitive
			virtual void releasePrimitive(void * prim) =0;

			/// purge all primitives from memory.
			virtual void purge() =0;


			/// (Optional) Defragmenting storgate memory
			/// tries to lock the manager object for defragmenting.
			//virtual bool trylock(void * array) =0;

			/// Returns datastructure for the deframenter
			//virtual void * processDefragment() const =0;


			/// #6 Node Transport stage memory managment

			/**
			 *	Initiates the process of transporting read-write primitives from the
			 *	storgate buffers into rendering buffer.
			 *	For singleshot rendering, this is not required.
			 */
			virtual void beginTransport(size_t prims) =0;

			/// Points the read-write primitive to be transported
			virtual void transportNode(void * prim) =0;

			/// Returns write-only range where verticles can be writed.
			virtual void * getTransportRange(size_t & size) =0;

			/// Finalizes the transport
			virtual void finalizeTransport() =0;

			/// Returns datastructure descibling the payload for the renderer.
			/// structure is defined in derived classes.
			virtual void * getRenderInputs() =0;
	};
}

#endif // CVIPRIMITIVEMEMORYMANAGER_H_INCLUDED
